<?php
class libsession {
    public $session_arr = array();
    public function __construct() {
        $id = session_id();
        if(empty($id)) {
            session_start();
        }
    }
    public function &__get($name) {
        if(isset($_SESSION[$name])) {
            return $_SESSION[$name];
        } else {
            return null;
        }
    }
    public function __isset($name) {
        return isset($_SESSION[$name]);
    }
    public function __unset($name) {
        unset($_SESSION[$name]);
    }
    public function __set($name, $value) {
        if(property_exists($this,$name)) {
            $this->$name = $value;
        }
        $_SESSION[$name] = $value;
    }
}
